package com.ygp.synchronizedtest;

//import lombok.extern.slf4j.Slf4j;

/**
 * <Description> <br>
 *
 * @author linmiaolai@sanyygp.com<br>
 * @version 1.0<br>
 * @date 2021/10/16 <br>
 */
//@Slf4j(topic = "c.SynchronizedTest")
public class SynchronizedTest {
    private static int count = 0;

    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread("t1") {
            @Override
            public void run() {
                for (int i = 0; i < 5000; i++) {
                    count++;
                }
            }
        };
        Thread t2 = new Thread("t1") {
            @Override
            public void run() {
                for (int i = 0; i < 5000; i++) {
                    count--;
                }
            }
        };
        t1.start();
        t2.start();
        t1.join();
        t2.join();
//        log.debug("{}", count);
    }
}
